home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Info-Mac 4
/
Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso
/
Configuration
/
TE3Click 1.0 folder
/
Source Code
/
TE3Click init.c
next >
Wrap
C/C++ Source or Header
|
1994-03-08
|
1KB
|
62 lines
/*
* TE3CLICK PROJECT
* INIT CODE
*
* Copyright © 1994 Marco Piovanelli
* All Rights Reserved
*/
/* TRAP DEFINITIONS */
#define _GetOSTrapAddress dc.w 0xA346
#define _SetOSTrapAddress dc.w 0xA247
#define _GetToolTrapAddress dc.w 0xA746
#define _SetToolTrapAddress dc.w 0xA647
#define _NewPtrSysClear dc.w 0xA71E
/* miscellaneous constants */
#define kPatchType 'PATC'
#define kPatchID 2139
void main(void)
{
asm {
clr.l -(sp) ;
move.l #kPatchType, -(sp) ;
move.w #kPatchID, -(sp) ;
_Get1Resource ; get patch resource
move.l (sp)+, d2 ;
beq.s @exit ; NIL resource handle: exit
movea.l d2, a0 ;
_GetHandleSize ; get patch size
move.l d0, d1 ;
_NewPtrSysClear ; allocate a block this size in sys heap
bne.s @exit ; couldn't allocate memory: exit
movea.l d2, a1 ;
movea.l (a1), a1 ;
exg a0, a1 ;
move.l d1, d0 ;
_BlockMove ; copy patch to sys block
move.w #0xA9D4, d0 ;
_GetToolTrapAddress ; get _TEClick address
move.l a0, 2(a1) ; copy original address to patch header
move.w #0xA9D4, d0 ;
movea.l a1, a0 ;
_SetToolTrapAddress ; install patch
move.l d2, -(sp) ;
_ReleaseResource ; throw away patch resource
@exit ; implicit rts
}
}